Use file's grammar to detect if it can be formatted.

Because the file extension may not always accurately describe a file's contents,
use the file's grammar. The user can now manually set the grammar of a file that
doesn't end with .json or .js and it can be formatted.

Also using the grammar to detect validity covers other javascript file
extensions such as .es6 and .jsx.
Adding support for formatting the current selection(s)
Merge pull request #10 from plemarquand/master

Format Selection and Grammar Detection