Ants dominate many terrestrial ecosystems, yet we know little about their nutritional physiology and ecology. While traditionally viewed as predators and scavengers, recent isotopic studies revealed that many dominant ant species are functional herbivores. As with other insects with nitrogen-poor diets, it is hypothesized that these ants rely on symbiotic bacteria for nutritional supplementation. In this study, we used cloning and 16S sequencing to further characterize the bacterial flora of several herbivorous ants, while also examining the beta diversity of bacterial communities within and between ant species from different trophic levels. Through estimating phylogenetic overlap between these communities, we tested the hypothesis that ecologically or phylogenetically similar groups of ants harbor similar microbial flora. Our findings reveal: (i) clear differences in bacterial communities harbored by predatory and herbivorous ants; (ii) notable similarities among communities from distantly related herbivorous ants and (iii) similar communities shared by different predatory army ant species. Focusing on one herbivorous ant tribe, the Cephalotini, we detected five major bacterial taxa that likely represent the core microbiota. Metabolic functions of bacterial relatives suggest that these microbes may play roles in fixing, recycling, or upgrading nitrogen. Overall, our findings reveal that similar microbial communities are harbored by ants from similar trophic niches and, to a greater extent, by related ants from the same colonies, species, genera, and tribes. These trends hint at coevolved histories between ants and microbes, suggesting new possibilities for roles of bacteria in the evolution of both herbivores and carnivores from the ant family Formicidae.