Natural compounds kill bacteria much in the same way that industrially prepared chemicals or treatments do. Natural compounds that kill bacteria are called bacteriocins, or in other words the extracellular enzymes produced by bacteria to kill other bacteria.
Many bacteriocins kill bacteria by cleaving essential components in cell walls such as beta-lactam. (This is also the same way that penicillin works, which is produced by fungi.) Bacteriocins can also cause cellular lysis by activating the cells apoptotic cycle. (programmed cell death)
One of the more common ways that natural compounds kill bacteria is by preventing them from producing proteins that are required for the cell to survive. Also, these compounds prevent the uptake and formation of folates which is required for bacterial metabolic processes which also causes cell death.