This comparison was originally posted in the "Academic Analysis: Obscurous Books" subforum at The Leaky Lounge in September 2005 (i.e. after the publication of the 6th book in the series, The Half-Blood Prince).
Basically, I feel that the interpretation I made back then still holds. Apart from adding a few clarifications, I have let my original conclusions and conjectures stand as they were at that time, but have added some "post Deathly Hallows" footnotes at the bottom.
* * *
Digging deeper into the meanings of names used in the Harry Potter books, I came across the idea that Dumbledore's second middle name, Wulfric*, together with his victory over the evil wizard Grindelwald in 1945, is probably an allusion to the old tale of Beowulf & Grendel. (*Dumbledore's full name is Albus Percival Wulfric Brian Dumbledore.)
I had never really read the whole poem about Beowulf, just struggled with excerpts from it in Old English in my language studies, many years ago. Now I got curious, searched and found an adaptation of it into modern langugage. * (See link at the bottom of this post.)
After reading the whole poem, I searched the internet again for comparisons between Beowulf and Harry Potter. To my surprise, I found almost nothing; most of the links that came up seemed to focus on a translation of Beowulf winning some literary prize in 2003, with the Harry Potter books coming in second. Other links just kind of drew general classic hero parallells. I haven't seen anyone suggest what now seems obvious to me:
The Beowulf poem seems to have been used by Rowling as foundation (or "skeleton") for the story in the Harry Potter books, in almost chronological order from beginning to end. "Starring" Dumbledore as king Hrothgar, Harry as Beowulf, and Grendel/ the Dragon as Voldemort; but with a shift of perspective when it comes the death of Beowulf, whose funeral in the poem resembles Dumbledore's.
This makes me guess Rowling must have found those literary prize discussions hilarious - people discussing how Beowulf "won" over Harry Potter, but no one -?!- recognizing that she's basically using the same old story… (?)
Comparing the plots
In Beowulf we first meet a king named Hrothgar (= Dumbledore), who has won many battles and is well respected by everyone. He builds a mead-hall, a "high-towered" building, "the greatest the world had ever seen, or even imagined" (= Hogwarts Castle with its Great Hall; there is possibly also an allusion to the mead-hall in the name of the village, Hogsmeade). The name of Hrothgar's hall is Herot, which means "hart". (Note Harry's "patronus" being a stag.) In the Hall the old king sits at the table with "his most trusted men" (= the teachers' table at Hogwarts).
The introduction of the Beowulf poem mentions the four elements: earth, water, air, light (=fire). These four elements also used as a basis for the structure of the Harry Potter books. For example, the houses of Hogwarts can be said to each represent one of the four elements: Hufflepuff/Earth, Slytherin/Water, Ravenclaw/Air, Gryffindor/Fire.
In Beowulf there is an evil demon, Grendel, "of the race of Cain, that man punished for murdering his brother", who threatens the peace in the kingdom and the hall. (=Voldemort)
Grendel begins to attack the Hall. "Grendel killed more - blinded by sin, he felt no remorse." Finally, he even moves into the Hall himself. (Voldemort moves into Hogwarts in Book 1 by possessing Professor Quirrell.)
Then comes a warrior, Beowulf, to the rescue, with a number of companions. They arrive over the sea by ship (Harry and other first-years arrive by boat over the lake in Book 1), armed with spears of "ash wood tipped with gray" (=wands of wood with core of something else). Beowulf's father was "a leader well known among the people" (=Harry's father, James Potter, was well known as a member of the opposition against Voldemort in his time). Hrothgar also says he knew Beowulf "when he was a boy". (Dumbledore knew Harry when he was a baby.)
Beowulf defeats Grendel not by weapons - "no battle sword could harm him - he had enchantment against the edges of weapons" - but by "firmly grasping Grendel's hand until the fingers broke". In Book 1, The Philosopher's Stone, Quirrell-Voldemort cannot endure the touch of Harry's bare skin, and that is how Harry defeats him.
We also learn that "Each was hateful to the other alive." Compare the prophecy made about Harry and Voldemort: "… and either must die at the hand of the other for neither can live while the other survives…" (We don't learn about the prophecy until Book 5, however.)
Grendel, mortally wounded, withdraws; the warriors rejoice; and the King gives a feast in his Hall, which is decorated with "gilded banner"; many speeches are delivered. Harry defeats Quirrell/Voldemort at the end of Book 1, and afterwards there is a feast in the Great Hall, with Gryffindor decorations (red and gold).
But… It turns out that Grendel's mother, a fearful water-monster, is seeking revenge, and again the Hall and its inhabitants are seized by terror. And again, Beowulf comes to the rescue, kills the water-monster and cuts the head off the already mortally wounded Grendel. In Book 2, "The Chamber of Secrets" is reopened, letting a frightful monster, a Basilisk, loose in the castle. Harry fights the Basilisk and Voldemort's memory/diary down in the Chamber. The entrance to the Chamber is through the waterpipes.
Between and after the battles in the poem, both recent and historic events are repeated in songs and tales, seen from different angles. In HP Book 3,The Prisoner of Azkaban, Voldemort "retreats", but Harry & co are learning more about the past. In Book 4, the Goblet of Fire, we have a repetition of earlier themes in the Triwizard Tournament, which also involves Harry going down under water to rescue his friends from the Mer-People; more of the imagery from Beowulf's adventure under water is used here.
While Beowulf is under water, "The old gray-hairs spoke together, saying they did not expect the famous prince to be victorious." There is much discussion in Book 4 about Harry's being in the Tournament at all, and if he will be able to win, or even survive.
After Beowulf resurfaces, with Grendel's head as proof for his deeds under water, Hrothgar gives a long speech again, and explains what it takes to be a good warrior. Peace can be as dangerous as war, because when you have won great victories, you can be overcome by arrogance:
but then arrogance grows;
the guardian of his soul
sleeps. That sleep is
too heavy, bound with affliction,
and the killer very near who shoots his bow
with evil intent.Then he is hit
in the heart,
beneath his armor,
with a bitter arrow--
he cannot guard himself
against the perverse commands
of his accursed spirit.
In Book 5, The Order of the Phoenix, Harry has to fight "mind battles", not only accusations from other people, but in his own thoughts, and nightly visions. He also has to take lessons in how to guard himself againt these attacks, but finds this very hard to practise.
Beowulf becomes king. After the Return of Voldemort is officially acknowledged, Harry in Book 6 is regarded as "the chosen one". And at the end of Book 6, The Half-Blood Prince, Dumbledore is relying on Harry instead of Harry on Dumbledore. The Beowulf poem shifts perspective, and so, I believe, does Rowling; at least in part, since some of the things that happen to Beowulf at the end are rather what happens to Dumbledore in book 6. The description of Beowulf's Funeral fits the description of Dumbledore's funeral - big fire, smoke, mound/tomb…
Before that, the Beowulf poem tells of a Dragon, who has collected a hoard. But a thief comes along and takes one of the treasures. However, "the thief did not of his own accord plunder the treasure". The treasures are hidden in a "cave /that/ stood near the sea, protected by secret spells." In Book 6, Dumbledore tells Harry about Voldemort's Horcruxes; valuable objects that he has put parts of his own soul into, and hidden. All these objects must be found and destroyed, before Voldemort can be killed. One of the objects, a locket, was hidden in a cave near the sea. Dumbledore and Harry go to retrieve it; it turns out, however (but not until after Dumbledore's death) that the original locket had already been stolen earlier by a person with the initials "RAB", whose identity is not revealed in Book 6. "The thief" could fit both RAB and/or Dumbledore 
The theft awakes the Dragon: "The thief had stepped with insidious craft near the dragon's head." He goes looking for revenge - "went in flame, prepared with fire" - "The beginning was fearful to people in the land, as was the ending: death for their king." Dumbledore somehow burned his hand in connection with destroying another of the Horcruxes, a ring. At the end of Book 6, he is hit by the Avada Kedavra curse – a deadly curse which includes a flash of fire. 
In the episodes which tell of the final slaying of the Dragon in the Beowulf poem, I believe we're probably entering the realm of Book 7 in the HP series, which makes it hard to draw exact parallels yet. But a few hints - maybe…
"(Beowulf) knew for a fact that the best wood --- couldn't help against flame." Harry knows his wand can't kill Voldemort. (This was established in Book 4.) 
"Beowulf scorned a host, a large army, when he sought the dragon --- No one but myself can fight this monster." – But Beowulf finds that he can't kill the dragon alone. He tries to cut off the dragon's head by sword, but the sword "stuck in the dragon's head. --- Then Wiglaf showed courage, craft and bravery, as was his nature--he went not for the thought-seat, but struck a little lower /the heart/, helped his kinsman though his hand was burned. --- Then the king controlled his senses, drew his battle knife "--- and cut the dragon through the middle. The enemy fell--strength had driven out life; the two kinsmen, together, had cut down the enemy. So should a warrior do."
At the end of Book 6, Harry thinks that he has to find and destroy the horcruxes and kill Voldemort all by himself. If Rowling is consistent in following the Beowulf outline, Harry probably won't be as alone as he thinks. Remains to be seen who "Wiglaf" will turn out to be...? 
And since the funeral scene at the end of the Beowulf poem has already been used in Book 6, I don't think that Harry will actually have to die at the end of Book 7. 
We also in the Beowulf tale have many such things as: Cups, ancient swords (cf. Gryffindor sword), a sword's guard (sheath) (cf. the Sorting hat, which serves as a sheath for the Gryffindor sword in Book 2) , objects decorated with ancient runes and snake ornaments (as are some objects in the HP books), shields (cf. shield charms), ravens (Ravenclaw), a strong-horned hart (Harry's Patronus and James' Animagus + nickname "Prongs"), horses (cf. Centaurs, Hippogriffs, Thestrals, brooms), importance of lineage (pureblood vs mudblood theme in HP) and ancient heirlooms (Voldemort's Horcruxes), a melting swordblade (a knife-blade melts away when Harry tries to open a locked door in the Department of Mysteries in Book 5), "gold ancient men had encircled with a spell so that no man could touch it" (again, the Horcruxes)…
And there are phrases like:
"It's a mystery where a good man goes when he reaches his end, when he can no longer live in the houses of men", and
"He was alive still, sound in mind, that aged man…" 
* * *
In Retrospect (February 2009)
 It turned out that it was the house-elf Kreacher, servant of RAB (=Regulus Black), that removed the original locket from the cave. Since he did it on his master's order, not by his own initiative, he fits with the thief in the Beowulf poem who "did not of his own accord plunder the treasure".
 I was not convinced after book 6 whether Dumbledore was really killed by the Avada Kedavra curse, or if there was some kind of stunt involved, so that he was just faking his death. See also footnote  below.
 The fact that Harry could not kill Voldemort with his (Harry's) wand actually played a bigger role in the previous books than it did in the last one. In The Deathly Hallows, what turned out to be of greater importance was that Voldemort also knew that he would not be able to kill Harry using his (Voldemort's) old wand, and therefore had to seek for another one.
 Harry did have to duel Voldemort alone at the end, but at the same time he could not have finished him off without help. He had help in destroying all the Horcruxes (except the Diary back in Book 2). The last one was Nagini, the big snake that also helped Voldemort to get "reborn" in Book 4 – cf. Grendel's mother, the water-monster. It was Neville who killed her, and so played the final Wiglaf part. Something that many readers suspected, even if they didn't think of Beowulf/Wiglaf, but simply because Neville fitted the original prophecy just as well as Harry (both boys being born at the end of July the same year, to parents who had opposed Voldemort). What made Harry "the chosen one", was really the choice of Voldemort himself (as Dumbledore pointed out to Harry).
 … and I was right, Harry did not really die…
 The Sorting hat again acts as a sword sheath in Book 7, when it delivers the Gryffindor Sword to Neville, so that he can kill Nagini; in much the same way it was delivered to Harry in Book 2, when had to kill the Basilisk in the Chamber of Secrets.
 "It's a mystery where a good man goes when he reaches his end, when he can no longer live in the houses of men" - "He was alive still, sound in mind, that aged man…"
These phrases in the Beowulf poem was one of the reasons why I doubted that Dumbledore had really died! As it turned out, Dumbledore did die; but Harry still got to meet him again, in a "mystery place" – reminding Harry of King's Cross station – dead but at the same time "alive still, sound in mind, that aged man"…
* Link: Beowulf (e-text)