In the second statement you explicitly define the class (database) for which you grant privileges. Consider an example where you have and object called Test in a database named Test. Without defining the class it could be unclear for which class you are about to give permissions.
It's perhaps easiest to understand by looking at the error messages for invalid GRANT statement
The following statement
GRANT ALTER ON NotExisting TO SomeOne
would produce
Msg 15151, Level 16, State 1, Line 4
Cannot find the object 'NotExisting', because it does not exist or you do not have permission.
while
GRANT ALTER ON database::NotExisting TO SomeOne
would output
Msg 15151, Level 16, State 1, Line 6
Cannot find the database 'NotExisting', because it does not exist or you do not have permission.
In your first example you don't define any securable so database is used by default.