Two specific types of flavonoid, flavones and anthocyanins, were both found to have benefits that could lessen diabetes risk.
Flavones are found in herbs and some vegetables, such as parsley, thyme and celery, while anthocyanins are abundant in dark coloured berries and fruits, as well as red wine.
Study leader Professor Aedin Cassidy, from the University of East Anglia, said: "This is one of the first large-scale human studies to look at how these powerful bioactive compounds might reduce the risk of diabetes.
"Laboratory studies have shown these types of foods might modulate blood glucose regulation - affecting the risk of Type 2 diabetes. But until now little has been known about how habitual intakes might affect insulin resistance, blood glucose regulation and inflammation in humans.
"We found that those who consumed plenty of anthocyanins and flavones had lower insulin resistance. High insulin resistance is associated with Type 2 diabetes, so what we are seeing is that people who eat foods rich in these two compounds - such as berries, herbs, red grapes, wine - are less likely to develop the disease.
"We also found that those who ate the most anthocyanins were least likely to suffer chronic inflammation, which is associated with many of today's most pressing health concerns including diabetes, obesity, cardiovascular disease, and cancer.
In addition women who consumed the most flavones had improved levels of a protein called adiponectin which helps regulate a range of metabolic processes, including glucose control.
The findings are published in the Journal of Nutrition.
Prof Cassidy added: "What we don't yet know is exactly how much of these compounds are necessary to potentially reduce the risk of Type 2 diabetes."
Chocolate contains another class of flavonoid called flavonols which have been linked to a reduced risk of heart disease.
Professor Tim Spector, director of the TwinsUK study at King's College London, who took part in the research, said: "This is an exciting finding that shows that some components of foods that we consider unhealthy like chocolate or wine may contain some beneficial substances.
"If we can start to identify and separate these substances we can potentially improve healthy eating. There are many reasons including genetics why people prefer certain foods so we should be cautious until we test them properly in randomised trials and in people developing early diabetes."
- PAA