1580s, "form of speech peculiar to a people or place;" meaning "phrase or expression peculiar to a language" is from 1620s; from Middle French idiome (16c.) and directly from Late Latin idioma "a peculiarity in language," from Greek idioma "peculiarity, peculiar phraseology" (Fowler writes that "A manifestation of the peculiar" is "the closest possible translation of the Greek word"), from idioumai "to appropriate to oneself," from idios "personal, private," properly "particular to oneself."
This is from PIE *swed-yo-, suffixed form of root *s(w)e-, pronoun of the third person and reflexive (referring back to the subject of a sentence), also used in forms denoting the speaker's social group, "(we our-)selves" (source also of Sanskrit svah, Avestan hva-, Old Persian huva "one's own," khva-data "lord," literally "created from oneself;" Greek hos "he, she, it;" Latin suescere "to accustom, get accustomed," sodalis "companion;" Old Church Slavonic svoji "his, her, its," svojaku "relative, kinsman;" Gothic swes "one's own;" Old Norse sik "oneself;" German Sein; Old Irish fein "self, himself").
[G]rammar & idiom are independent categories; being applicable to the same material, they sometimes agree & sometimes disagree about particular specimens of it; the most can be said is that what is idiomatic is far more often grammatical than ungrammatical, but that is worth saying, because grammar & idiom are sometimes treated as incompatibles .... [Fowler]