The vulnerability of ecologically specialised species to environmental fluctuations has been well documented. However, population genetic structure can influence vulnerability to environmental change and recent studies have indicated that specialised species may have lower genetic diversity and greater population structuring compared to their generalist counterparts. To examine whether there were differences in population genetic structure between a dietary specialist (Chaetodon trifascialis) and a dietary generalist (Chaetodon lunulatus) we compared the demographic history and levels of gene flow of two related coral-feeding butterflyfishes. Using allele frequencies of ≥11 microsatellite loci and >350 bases of mitochondrial control region sequence our analyses of C. trifascialis and C. lunulatus from five locations across the Pacific Ocean revealed contrasting demographic histories and levels of genetic structure. Heterozygosity excess tests, neutrality tests and mismatch distributions were all highly significant in the dietary specialist C. trifascialis (all P < 0.01), suggesting genetic bottlenecks have occurred in all locations. In contrast, we found little evidence of genetic bottlenecks for the dietary generalist C. lunulatus. High gene flow and low genetic structuring was detected among locations for C. trifascialis (amova: RST = 0.0027, P = 0.371; ΦST = 0.068, P < 0.0001). Contrary to our expectations, a greater level of genetic structuring between locations was detected for C. lunulatus (amova: RST = 0.0277, ΦST = 0.166, both P < 0.0001). These results suggest that dietary specialisation may affect demographic history through reductions in population size following resource declines, without affecting population structure through reductions in gene flow in the same way that habitat specialisation appears to. Although C. trifascialis is highly vulnerable to coral loss, the high gene flow detected here suggests populations will be able to recover from local declines through the migration of individuals.