What is the difference between `brew` and `brew cask`? So, what is the difference between brew and brew cask?

I know that homebrew is a package management software. But what kind of software can I get there? Is it open source software and commercial software?
Homebrew

brew is the core command for the Homebrew project.


  The missing package manager for OS X
  
  Homebrew installs the stuff you need that Apple didn’t.


Homebrew typically deals with command line software. Most of the software is distributed under an open source licence. See the Formulas for a list of available installs.

brew prefers pre-compiled binaries but will compile from source in some cases.

Cask

brew cask is an extension to brew that allows management of graphical applications through the Cask project.


  Homebrew Cask extends Homebrew and brings its elegance, simplicity,
  and speed to OS X applications and large binaries alike.


Cask deals with a mixture of software and licences. The software I work on is covered by a commercial licence and available via cask.

Cask offers a way to command line manage the installation of graphical applications.

See brew cask issue #7002 about the project's focus on predictability and how that affects the use of pre-compiled binaries or source.

Licensing

Availability through brew or cask does not imply any specific licence.