There are several categories of organic compounds that are responsible for aromas - esters, ketones, and aldehydes are the most notable.
Esters are formed when an alcohol and an acid combine; creating esters is a common laboratory experiment in high-school chemistry - I remember making peppermint and banana. This is the actual compound responsible for making peppermint smell like peppermint; the way we synthesized it in the lab isn't necessarily the way the peppermint plant makes it, but the result is identical.
A similar process happens during fermentation and aging of wine: the acids and alcohols present combine to form the compound that makes a cherry smell like a cherry, a thyme sprig smell like thyme, etc.
Just to be clear, most fermented beverages are going to have some of these aroma compounds as byproducts of fermentation. But grapes are notable in that they produce many more different acids than other fruits. So the range of possible aroma compounds is greater in wine than in, for example, cider - since apples don't have the variety of acids that grapes do, and can't make as many different esters.