I actually agree with PLSS that music wise, Nirvana might be the worst of the four. Alice in Chains and Soundgarden are easily better IMO, and it's a close call with Pearl Jam. That said, the impact Kurt Cobain and Nirvana had on pop culture is too big for something like the Rock and Roll Hall of Fame to ignore, so that is why they get in.
Plus when you are good and die young, you get immortalized as some kind of genius. The same thing is true in rap. Biggie is considered by some to be the greatest rapper of all time, even though he only put out two albums while alive. We have no clue how the rest of his career would go. If Nas died after his first album, would he be considered the greatest? Point is, we don't know how good Nirvana or B.I.G. would have been.