Probably the easiest way to buy train tickets for Budapest to Belgrade is to visit the ticket office in Budapest, which is located in Keleti Station and this is also the departure location. If you enter through the main entrance the international ticket office is hidden on the left side behind some food shops. There is a pathway between them that will take you to the ticket area. Make sure you get a ticket number when you arrive at the ticket office, rather than waiting in line. Your number and ticket counter will appear on the screen when it is your turn. We waited about 15 minutes before being helped. The lady spoke English very well and was able to book our tickets in a couple of minutes. The cost was 15 Euros/person and they accept credit cards. These were 2nd class tickets and do not have a reservation. So there is no seat assignment and basically, you can use these tickets on any day, up to 30 days from the date of purchase.
I would advise getting to the train platform a little early to make sure that you board early and get a good seat as the train can get crowded and if you have large luggage it can be a problem. We like to get the window seats and sit across from each other so we have the view and the small table to put our snacks on through the ride.
The cars are the usual 6 seat compartments with 3 seats on each side. Our train seemed fairly new and was comfortable. The train stopped many times throughout the journey. Especially at the border where customs officials will board and you will need to show your passport to get stamped. Then once that is done you will cross into Serbia where the train will stop again in Subotica and their custom officials will board and you will need to provide your passport again! Once you get past the border the stops are less frequent and in our case, we arrive in Belgrade (Beograd) 4 hours later. Good thing it is the last stop, so no chance of missing your station ;).