In Beowulf, two different royal houses are defined: House of Hrethel and The Scyldings. Beowulf belonged to the House of Hrethel and Hrothgar belonged to the Scyldings.
The Scyldings, in accordance to the epic, began with Scyld Scefing (Hrothgar's great-grandfather). Scefing's son was Beow, who then fathered Helfdene. Helfdene fatherd four children (Hrothgar, Heorogar, Halga, and Yrse (while some argue Yrse's place in the Scylding house).
Hrothgar married Wealhtheow. They had had three children (Hrethic, Hrothmund, and Freawaru).
Therefore, the three generations of the Scyld are:
First generation: Scyld Scefing
Second generation: Beow
Third generation: Helfdene
Hrothgar is the fourth generation of the Scyldings.