The Rule: "While" can be used to mean "during the time that," and it can be used to mean "whereas."
In the former case, while is not preceded by a comma.
In the latter case, while must be preceded by a comma.
So: I can't study while my little brother is beating on his drum.
And: The Blue Ridge mountains are beautiful, while the Rockies are grand.
Purists and copyeditors tend to frown on the use of "while" to mean "whereas," because the meaning depends upon the comma and points of punctuation have a perverse way of not being where they should be.
If you choose to use "while" to mean "whereas," it's important to be assiduous in your punctuation.