First you need to press:
Shift ⇧ + Command ⌘ + 4
This will take you into partial screenshot mode.
Then you need to press:
This will take you into window screenshot mode.
If you click any application window, you will grab the screenshot of the application. However, you'll also get the shadow.
If you don't want shadow, you should hold:
Key while clicking the window.