According to Shira Gabriel, an associate professor of psychology at the State University of New York, Buffalo, the best way to understand the question is to shift the focus away from the food itself.

Gabriel’s research broadly defines “comfort food” as anything that a person uses to feel better, but in the U.S., the term calls some specific, universal things to mind: ice cream, mashed potatoes, French fries, and other simple, often indulgent meals or snacks. When a woman on a sitcom is feeling down, she busts out the ice cream. When someone in the 1970s South is having a bad day, they go for the grits.

But to equate “comfort food” with “caloric” is to misunderstand where the comfort actually comes from, Gabriel says. “When we think about something like comfort food, we tend to think about it as providing calories or warmth or a sense of well-being,” she tells me. “But what we don’t think about is that comfort food also provides something social to us.”

In a study recently published in the journal Appetite, Gabriel and colleagues from SUNY-Buffalo and the University of the South ran a pair of experiments to shed light on what that something social might be. In the first, volunteers chose a description that most closely matched their attachment style. (Loosely translated from psych-speak, “attachment style” means the ability to form strong, healthy emotional bonds, a trait that typically takes root at an early age, starting with one’s parents. People with secure attachment styles can easily form these bonds and tend to view their relationships positively; people with insecure attachment styles, less so.) Half of them were then asked to remember a fight they’d had with someone close to them. When the participants were given potato chips, those who had been asked to describe a conflict ranked the snack as tastier—but only, the researchers found, among the ones with a secure attachment style. Among those whose emotional relationships were shakier, there was no significant difference in enjoyment between the people who had revisited painful memories and those who hadn’t.

The second experiment yielded similar results: After filling out a survey on their attachment style, volunteers kept a daily food-and-feelings diary for two weeks, recording how much they ate, whether they had consumed what they considered to be comfort food, and whether or not they felt lonely. Measuring food intake against self-reported levels of isolation, the study authors found that people with strong emotional relationships were more likely than others to reach for comforting foods on the days that they felt lonely.

Both sets of results, Gabriel and her co-authors believe, point to the same idea: that comfort food’s power may lie primarily in the associations it calls to mind. People who have positive family relationships are more likely to reach for reminders of those relationships in times of sadness—and often, those reminders come in the form of something edible. A grilled cheese sandwich can be a greasy, gooey, satisfying endeavor in its own right, but even more so if it features in happy childhood memories.