How can we differentiate so many different foods if we can only taste four flavors on our tongue: sweet, bitter, sour, and salty?
Humans can taste more than four flavors on their tongue. Depending on how narrowly you define "taste", there are between five and several dozen independently experienced sensations on the tongue, according to the book "Taste and Smell: An Update" by Thomas Hummel. The seven most common flavors in food that are directly detected by the tongue are: sweet, bitter, sour, salty, meaty (umami), cool, and hot. Note that "cool" and "hot" tastes do not refer to actual low or high temperatures being present, but rather to foods that chemically trigger a sensation that is similar to cool or hot sensations. Sweet flavors come from things like candy and fruits. Bitter flavors come from many vegetables and unsweetened chocolate. Sour flavors are contained in anything with acid, such as citrus fruits or vinegar. Salty flavors obviously come from anything with salt, such as chips or nuts. Meaty flavors come from anything with glutamates such as soy sauce, cheese, and meat. Cool flavors come from certain chemicals such as in mint and menthol. Hot flavors come from other chemicals such as in chili peppers and black peppers. Beyond these seven basic tastes, there are several other flavors that researchers have found receptors for, including calcium, dryness, fattiness, heartiness, and numbness. But returning back to the original question, it is true that humans experience far more flavors than the tongue can detect. The reason for this is that the nose plays an integral part in the experience of taste, and the nose can detect thousands of different smells.