Terpenes
The aromatic compounds made in the same glands as cannabinoids, and the reason each variety smells as it does.
Terpenes are a large family of aromatic compounds built from five-carbon isoprene units. In cannabis they are made in the secretory cells of the glandular trichomes, alongside the cannabinoids, and they are what gives one cultivar its citrus note and another its pine or pepper.
Two groups dominate. Monoterpenes such as myrcene, limonene and alpha-pinene are light and volatile, which is why the smell is strongest when a flower is fresh and fades as it dries. Sesquiterpenes such as beta-caryophyllene and humulene are heavier and persist longer.
Beta-caryophyllene is the one that crosses over into cannabinoid pharmacology: it binds the CB2 receptor directly, which is unusual for a compound found routinely in food. Terpenes are also central to the entourage effect, the proposal that the plant's compounds act differently together than alone.