Because it's a neutral color that doesn't strain the eye and allows for good legibility when using black or white fonts, and its neutrality aids to place the focus on the real content window.
The shade of gray will vary depending on the software, of course, ranging from a light gray to a very dark gray.
As for studies, here you can see why to use gray and its meaning
Additionally, take a look to Applying Color Theory to Digital Displays, and this question here on UX.SE