When we eat mint or spicy peppers, we describe these gustatory sensations as "cool" or "hot." Why is that? Is this just metaphorical language referring to the character of the flavors?

In this short video from SciShow, Hank Green explains the science of hotness-for-spice and coolness-for-mint. Pop in a mint and enjoy:

Closely related is the science of sweetness: