Humperdinck is heir to the throne of Florin. While initially seen only as a love rival, Humperdinck is later revealed to be the villain of the story. He plans to marry Princess Buttercup so he could have her assasinated in order to start a war with Florin's sworn enemy Guilder (by blaming Guilder for her death). For this, he hired Sicilian criminal mastermind Vizzini to kidnap and kill Buttercup for this goal.
When Westley foils this plot, Humperdinck takes Buttercup back after she has him promise not to hurt him. Instead, he has his ally Count Rugen imprison Westley with the intention of torturing him to death. After being insulted by Buttercup on the eve of their wedding, Humperdinck tries to kill Wesley. Inigo and Fessik find his corpse and have him revived by Miracle Max, whom Humperdinck had fired. While Wesley was still too physically weak to fight, he was still lucid enough to hatch a plan that would stop the wedding.
When Humperdinck comes across Wesley, he plans to kill him then and there, but Wesley surprises him by standing on his own with his sword pointed out. Wesley then says Drop. Your. Sword, which Humperdinck is only too eager to do. Buttercup then ties him to a chair and they gallop off into the sunset.
Since Humperdinck was never killed, he may very well have put a bounty on their heads afterwards. With Fessik and Inigo accompanying them, however, this would make his revenge difficult to achieve.