First of all, a fish opens its mouth and water enters which passes through its gills. This helps in oxygenating its blood. So, if any food particle is in its mouth, how can it "breathe" i.e. how does exchange of gases occur? Shouldn't the pathway where water flows from mouth to gills be clogged like a drain full of sludge?
They can pump water over their gills with their opercular flaps (i.e., the structure that covers and protects the gills). This is assisted by the branchiostegal rays. Food would generally not interfere with this process. Additionally, gill rakers assist in keeping food in the mouth.
Some great references for questions like this:
Barton, M., & Bond, C. E. (2007). Bond's biology of fishes. Thomson.
Moyle, P. B., & Cech, J. J. (2004). Fishes: an introduction to ichthyology (Vol. 726). Upper Saddle River, NJ: Pearson Prentice Hall.
Fish that are filter feeders generally have Gill Rakers which prevent food from actually damaging and clogging the gills.