Why are so many marine fish so specialised in their diet?
In the complex environment of a coral reef, there are huge numbers of species and many of them are in competition. One way to beat the opposition is to specialise in one or two specific food sources or ways to harvest a meal.
An example is the long nose of the Copperband Butterflyfish (Chelmon rostratus) which enables the fish to feed in small crevices inaccessible to shorter nosed species that would otherwise eat the same items. The astonishing feeding technique of the Dragon or Rockmover Wrasse (Novaculichthys taeniourus) is another way of finding food and a pair of adult fishes will alternate between lifting rocks and grabbing small animals sheltering beneath.
A common strategy is to find a food source that other species don't use and avoid competition entirely. Many Butterflyfishes feed on coral polyps of different species, enabling them to live in the same areas without competing with each other. Another strategy is to guard your food source and a number of Tangs, Damselfishes and Blennies are 'Algal Gardeners' and exclude all competitors from their territory where they farm the algae that feeds them - often removing species that they don't eat.