Fundamentally, at the bottom of the heap are 'lossy' formats which delete aspects of the music in order to fit the file on your phone. These include MP3, AAC, Ogg and others. Generally, avoid these for hi fi use - not much point in buying an expensive hi fi like an NDX and then putting poor quality files into it. If you must, higher sample rates are better (eg 320) but still there's something missing and they generally sound flat and lifeless. I think most people could easily tell the difference - certainly I have no trouble.
The critical thing is to rip or download in a LOSSLESS format. That way you have ALL the music. The two most common are FLAC and ALAC - the latter is an Apple standard. They are both compressed (generally) but, crucially, lossless. Think of them as being like a zip file, which is compressed for storage but then extracted to be identical to the original. Most people use FLAC, unless they're Apple fans in which case they use ALAC.
Supposedly the best in terms of sound quality is WAV, which is essentially the original music file. It is lossless and uncompressed, so a larger files size than FLAC or ALAC. It also has some issues with containing the data about album/artist/etc (called metatagging or tagging) which some people dispute or have overcome, and I won't dwell on. Again the Apple equivalent is AIFF.
I use FLAC because it's lossless and good for tagging. To get the best SQ I 'transcode' it to WAV, meaning that it's stored in FLAC but the NAS extracts it and turns it into WAV before it gets to the streamer. Various UPNP servers (software on your NAS) will do this, but it's certainly not essential, and many people can't tell the difference.
The most important thing is to use a lossless format, and as someone new to this, the easiest option is to go with FLAC unless you're an Apple fan in which case go for ALAC. You won't go far wrong.
So-called HD music is generally considered to be above CD standard. There is some dispute over whether there's an audible difference, but I would say it depends on the equipment and the ears. It's a nice-to-have really - CD quality sounds very good. All the above advice still applies anyway.