Similar to the question:
Why do drinks drunk from a glass instead of a bottle taste differently?
Where the top answer notes the logic behind each glass for a particular drink:
Wine glasses, for example, are optimal for giving the nose an opportunity to experience the wine. They enclose a volume that allows you to swish the wine in the glass (without spilling it) to impart the aroma to air in the glass. The usually tapered opening keeps the aroma from dissipating before your nose can sense the wine.
Champagne flutes, keep the effervescent champagne or prosecco bubbly and cold long enough to enjoy the drink without it going flat.
Different beer glasses are optimal for showcasing the "head" and are tall for the same reason as champagne flutes (to keep the effervescence going as long as possible).
How does the shape of the typical (see below) espresso cup affect its flavor?
CC image used with permission: Credit to Flickr user davharuk.