Changing the pivot point and using it to snap to grid
First go to the Edit mode of your Cube and select the vertex you want to snap the pivot to.





Then press ShiftS to open the Snap menu and select Cursor to Selected.  Now you will see the 3D Cursor appear at the vertex.





After that you have to quit the Edit Mode and go to the Object mode of the Cube, then press ShiftCtrlAltC to open Set Origin menu and choose Origin to 3D Cursor.





When thats been done, (still in object mode) press ShiftC  to make the 3D Cursor go back on the grid and while your Cube is selected press ShiftS and choose the second option Selection to Cursor.




Now this will snap your Cube on to the grid.