Maia,
There are trains traveling from Barcelona to Granada & vice-versa, but it looks like there are only 3 departures from each city daily.
Due to the work on the railway around Granada, your journey from Barcelona to Granada will involve an AVE (or MD) train & bus combination. So when you book your tickets, Barcelona to Granada (or the reverse), you will be traveling via train from Barcelona to Antequera Santa Ana ( train station), then you'll be guided to transfer to a bus (provided by Renfe) which will transport you to Granada's train station.
The main advantage in booking your train tickets in advance is to save money; since the price of tickets will increase as your date of travel approaches.
Enjoy!
P.S. Don't forget to book your Alhambra tickets up to 3 months in advance.
Some people choose to fly on this route. (Barcelona to Granada or vice-versa)
Check skyscanner.net for flight options.