Well, there are probably a thousand reasons a piano could rattle (starting with the music stand) but why are so many otherwise great recordings spoiled by rattles in expensive pianos? It's a mystery to me but here's one theory...
Before any important concert or recording the piano is wheeled into position and then tuned. Once tuned, no-one dares touch the instrument, let alone bash out a few chords to check for rattles. The talent arrives, the bashing begins, the rattles are unleashed, and another historic recording bites the dust.
Buzzing of the strings? Resonance of objects in the studio?
It could be objects, but usually it sounds like rattling bits of wood attached to the instrument. Maybe the sound effects guys add it in later to make it sound like the pianist is really laying into the instrument.