I noticed sometimes I see a grey border around the layout in IE.
I got also one on my site and it’s a bit annoying.
Switching from IE8 to IE9 or otherwise sometimes makes this border disappear, but not on all sites.
Does anyone have any ideas as to why it might happen?

It’s pretty much a telltale sign that you’re in Quirks Mode. Hit F12, and see what the Document Mode is listed as.
Then try to fix it. Make sure you have a valid
<!DOCTYPE>as the first thing in your document, make sure your document is well-formed, and try sending theX-UA-Compatible: IE=edgeheader (or include it as a<meta>tag).