It's generally pretty simple to recognise when something is Baroque, because it's likely to sound quite old fashioned to a modern listener. It might have a harpsichord, it's very unlikely to have any brass, and it's mainly going to be all about the strings. Telling the difference between Classical and Romantic period music is trickier. Overall, if it's an orchestral piece try to listen out for how much the brass is dominating the orchestra, and how many solos or really difficult sounding parts there are - the more there are, the more Romantic it sounds. If it's a piece for a solo instrument, Romantic music is often very virtuosic, or hard, because the composers in the Romantic era were often composing for themselves to perform, so they'd be showing off whatever particular skills they had.