In order to really answer your question, I must tell you the background story of Pyrrhus. Pyrrhus is the son of Achilles who was killed by Paris during the Trojan war. Pyrrhus wants vengeance for Achilles' death. Since Paris is already dead, he seeks out Paris's family, including Paris's father Priam.
Pyrrhus is a foil to Hamlet: He is a son seeking vengeance for his father's death. A foil is a character whose qualities are opposite of a principal character and who brings into the foreground the qualities of that character.
Let's look toward Hamlet's speech for further understanding of the comparison:
HAMLET. The rugged Pyrrhus, like th' Hyrcanian beast,--
it is not so:-- it begins with Pyrrhus:--
The rugged Pyrrhus,--he whose sable arms,
Black as his purpose,did the night resemble
When he lay couched in the ominous horse,--
Hath now this dread and black complexion smear'd
With heraldry more dismal; head to foot
Now is be total gules; horridly trick'd
With blood of fathers, mothers, daughters, sons,
(The entire section contains 673 words.)