Cannabis gets its unique flavor from its terpene profile. Terpenes are a group of volatile unsaturated hydrocarbons found in the essential oils of plants, especially conifers and citrus trees. There are over 200 terpenoid compounds that have been identified in cannabis. This is what results in the aroma, flavor and therapeutic effects you get after smoking. Eight of these compounds are most frequently found in common strains (taken from of Green: A Field Guide to Marijuana):
Some terpenoids are more easy to identify than others, especially when a cannabis strain contains several different terpenoids. The strain hunters from Green House Seed Company in the Netherlands have many years of experience identifying quality strains and they've created a way to identify the flavors within them. Below is a chart that they developed specifically for cannabis: