Polyphenolic compounds and flavonoids probably complex with bacterial cell walls, extracellular and soluble proteins, and also inhibit bacterial quorum-sensing signal receptors, enzymes, and toxins.
More information about this topic you can find in the following papers:
Cushnie TPT, Lamb AJ (2010) Recent advances in understanding
Metsämuuronen, S.; Sirén, H. (2019) Bioactive phenolic compounds, metabolism and properties: a review on valuable chemical compounds in Scots pine and Norway spruce. Phytochem. Rev. 18, 623-664. https://doi.org/10.1007/s11101-019-09630-2
Phenolic compounds (such as polyphenols and flavonoids) are hydrogen donors capable of directly scavenging free radicals and reducing oxidative damage, which makes them potent antioxidants. In addition to the antioxidant activity, phenolic compounds act as antimicrobial agents via several mechanisms including the disruption of microbial membranes. Because of the differences in the cell wall structures between Gram-positive and Gram-negative bacteria, This explains why the Gram-negative bacteria are generally more resistant to plant extracts (containing phenolic compounds) than the Gram-positive bacteria. Gram-negative bacteria have an extra hydrophilic outer membrane that functions as a preventive barrier against hydrophobic compounds and inhibits the accumulation of phenolic compounds in the target cell membrane.
For more information, DOI: 10.4103/epj.epj_44_18
Antioxidant and antibacterial properties of anise (Pimpinella anisum L.) .
DOI:10.1155/2018/6475072
Antimicrobial Effects of Egyptian Local Chicory, Cichorium endivia subsp . pumilum