Idiom (language structure)
Idiom is "the syntactical, grammatical, or structural form peculiar to a language". Idiom is the realized structure of a language, as opposed to possible but unrealized structures that could have developed to serve the same semantic functions but did not.
Language structure (grammar and syntax) is often inherently arbitrary and peculiar to a particular language or a group of related languages. For example, although in English it is idiomatic (accepted as structurally correct) to say "cats are associated with agility", other forms could have developed, such as "cats associate toward agility" or "cats are associated of agility". Unidiomatic constructions sound solecistic to fluent speakers, although they are often entirely comprehensible. For example, the title of the classic book English As She Is Spoke is easy to understand (its idiomatic counterpart is English As It Is Spoken), but it deviates from English idiom in the gender of the pronoun and the inflection of the verb. Lexical gaps are another key example of idiomaticness.
Emic and etic views
Monolingual native speakers in an insulated monolingual-native environment are mostly not conscious of idiomaticness (the quality or state of a construction matching the idiom of the given language), because in general their minds never reach for, or hear, other possible structures. The main exception is when they hear the natural experimentation of children acquiring the language, when they may encounter, for example, overregularization (for example, I seed two deers for I saw two deer). By this correlation, solecism to native-speaking monolingual minds often sounds "childish" or "mentally impaired". However, when adults study a foreign language, they become consciously aware of idiomaticness (and the lack thereof) and begin to have a more mature understanding of it, as their minds labor to master structural details different from the native language's details. For example, in English it is idiomatic to use an indefinite article when describing a person's occupation (I am a plumber; she is an engineer), but in Spanish and many other languages it is not (soy plomero; ella es ingeniera), and a native speaker of English learning Spanish must encounter and accept that fact to become fluent.
Although a typical gut reaction among beginning foreign language students is that "our language's way makes more sense", advanced learners (those who become fluently multilingual) come to realize that in most cases the various idioms are not inherently more or less logical—they simply have different logic, and they are peculiar to individual languages or branches of language families. In the occupational example, a Spanish speaker can "justify" the idiomatic lack of a definite article by pointing out that an article is logically superfluous; one doesn't need to say that she is [one discrete] engineer, because it is already inherently obvious that she is one discrete person. Such "logical explanations" (or apparently logical ones) in the end are moot to fluency—it doesn't matter whether anyone can find, or agrees with, a logic behind any particular idiomatic facet of language; it is simply the correct form, by normative convention. But language learners often cannot help thinking about such "logical explanations" during the process of foreign language acquisition.
The count sense of the word idiom, referring to a saying with a figurative meaning, is related to the present sense of the word by the arbitrariness and peculiarity aspects; the idiom "she is pulling my leg" (meaning "she is humorously misleading me") is idiomatic because it belongs, by convention, to the language, whether or not anyone can identify the original logic by which it was coined (arbitrariness), and regardless of whether it translates literally to any other language (peculiarity).