The relationship between animals and their gut flora is simultaneously one of the most common and most complex symbioses on Earth. Despite its ubiquity, our understanding of this invisible but often critical relationship is still in its infancy. We employed adult Neotropical butterflies as a study system to ask three questions: First, how does gut microbial community composition vary across host individuals, species and dietary guilds? Second, how do gut flora compare to food microbial communities? Finally, are gut flora functionally adapted to the chemical makeup of host foods? To answer these questions we captured nearly 300 Costa Rican butterflies representing over 50 species, six families and two feeding guilds: frugivores and nectivores. We characterized the bacteria and fungi in guts, wild fruits and wild nectars via amplicon sequencing and assessed the catabolic abilities of the gut flora via culture-based assays. Gut communities were distinct from food communities, suggesting that the gut environment acts as a strong filter on potential colonists. Nevertheless, gut flora varied widely among individuals and species. On average, a pair of butterflies shared 21% of their bacterial species and 6% of their fungi. Host species explained 25-30% of total variation in microbial communities while host diet explained 4%. However, diet was still relevant at the individual microbe level-half of the most abundant microbial species differed in abundance between frugivores and nectivores. Diet was also related to the functional profile of gut flora: compared to frugivores, nectivores' gut flora exhibited increased catabolism of sugars and sugar alcohols and decreased catabolism of amino acids, carboxylic acids and dicarboxylic acids. Since fermented juice contains more amino acids and less sugar than nectar, it appears that host diet filters the gut flora by favoring microbes that digest compounds abundant in foods. By quantifying the degree to which gut communities vary among host individuals, species and dietary guilds and evaluating how gut microbial composition and catabolic potential are related to host diet, this study deepens our understanding of the structure and function of one of the most complex and ubiquitous symbioses in the animal kingdom.