It is widely known that a great accompaniment to any meal is a glass of wine. However, beer may actually be more food-friendly than wine is, and there is certainly more room for variety of flavour.
A corollary of that concept is that the bitterness from hops function like wine acids in food pairings. Both cut through fattiness, oiliness, and even saltiness. Furthermore, bubbles cut through fried and fatty foods, so opt for more carbonation when eating richer dishes.
Remember the richness of food can come from the protein (like beef), sauce (such as cream sauce), method of preparation (frying for example), as well as fat, spice, sweetness and texture.
A beer that complements the food should help enhance the flavour. Choose mild beers with mild dishes, robust beers with robust foods, and bold, hoppy beers with spicy dishes. Also look for common flavour or aroma elements such as nutty, fruity, chocolatey or tart. A sip should evoke flavours in past and future mouthfuls.
Contrast can also add a new layer of complexity through flavours and mouthfeel. A combination of sweet and salty works wonders, and crisp, highly carbonated beer helps cleanse the palate with rich buttery dishes.
When pairing beers with a number of courses, always start with a lighter beer and work your way toward darker or more bitter beers. Beginning with a strong beer may overwhelm your palate early on and mask subtle nuances of flavour and aroma in the following courses.