In the first sentence you presented, the word “food” is used as a mass noun denoting forms of nutriment in solid form. So yes, you’re correct when you say that “food” here means a certain class or group of food (often to the exclusion of liquid food, which is called a “drink”), but the term could also be taken to denote all food in a generic sense, in which case it is considered a noncount noun. Such is the case in the sentence “Food is essential to life.” (We don’t say “Foods are essential to life.”)
In the second sentence you presented, however, the plural form “foods” in the term “healthful foods” is used in the sense of particular kinds of food—in this case from animal sources—such as milk, cheese, yoghourt, and meat. Here, of course, “foods” is a countable noun, and in my own encounters with the term, it is often used in the sense of processed or manufactured foods as opposed to natural produce such as specific fruits and other agricultural crops—like, say, apples, pears, and oranges as well as corn, beet, and yam. Unprocessed food of this kind is normally classified as “natural food” in the sense of a singular noncount noun.