What defines any given utterance in a language as "idiomatic"?
A. In the first place, it is something that no native speaker (of that same dialect) would object to. So it is simply the "normal" way of saying something. Something unidiomatic might be grammatically fine but simply normal.
"We are going to the movies."
*"We are attending the movies tomorrow."
We know the idiomatic use of "attend" is usually associated with an event, or an obligation like a class. Contrast "Estoy hambriento" with "Tengo hambre."
B. The second meaning of idiomatic has to do with the fixity of the phrase. The idea that there are "frases hechas" or "frases fijas" that just are the way something is normally said. These are idioms, but they might be transparent to the second language learner.
C. There could be a statistical definition of idiomatic. "I want to make one thing perfectly clear." That phrase, "perfectly clear," is one every has heard a million times. It is statistically probable. There are perfectly good phrases that sound ok but are statistically improbable. They aren't as "idiomatic," for this reason. "I want to make one thing impressively clear."
D. Next, there are idioms, fixed phrases, that are not transparent to the second language learner, or even the 1st language learner if sh/e doesn't happen to know the idiom. The basis of this sort of idiom is metaphor. "He's climbing the walls." The point is that we don't take this literally. So what makes language most distinctively idiomatic is the use of metaphor. Idioms are standard, or fixed metaphors that everyone understands (though not always!). They are also the normal, or statistically probable way of saying something.
E. Nobody knows what "go the whole nine yards means" on the literal level. The origins of the phrase are obscure. But speakers of American English know how to use the phrase and what it means. This means that we can understand metaphor without understanding it on the literal level. I understand "pull out all the stops" as a metaphor derived from playing the organ. This, in fact, is the origin of the phrase, and the metaphor makes sense: an organist pulls out stops to activate certain sounds. Pulling out all of them means "going the whole nine yards." I'm sure people understand this metaphor who've never thought about it in terms of an organ. My sister plays organ so I know what it means literally, but you don't have to. A third type of metaphor is one like "climbing the walls" where the literal meaning is transparent. We all get a mental picture of someone climbing the walls. What is amazing, though, is that we could understand it even if we didn't know what a wall was. It could be a fossilized phrase like "go the whole nine yards" and it wouldn't matter.