Needs to be FLAC (lossless) or MP3. The Model S used to support m4a, but that stopped working last summer for some reason.
There's a Mac utility,
TeslaTunes, that helps but it was written for the S when m4a was still supported so it copies over m4a as is. There is a
test build (see post on May 3rd by tattwamasi) that will convert m4a to FLAC, it works OK for the full library/folder of music, but doesn't work correctly if you convert a playlist (it deletes most of the FLAC files at the end of the process !?!?!?) Read further down that test build link to see details about that problem. Tattwamasi has replied, so I'm hopeful he'll be able to fix the playlist bug as my library's too large to convert the entire thing to FLAC.