Static electricity is generated by particles (air, dust, dirt, etc.) being rubbed across the insides of the vacuum and what ever is really close to the nozzle.
As far as I know, there is no way to ground the vacuum cleaner.
While most recommend against using a vacuum to clean parts, I have been doing it for years with no issues.
Personally, I believe the risk of static shock to be quite overstated.
Much more of a concern is the risk that you will suck up jumpers, cables or other small parts.
Just be sure to take care when cleaning your system and you should have no issues.