I have found a page which has steps to instal cppcheck on Mac OSX, but it is not clear what are we doing with 2nd step
Homebrew helps you install packages (software).
You need to install it in order to use it; that is what step 2 is doing, installing Homebrew.
Then, you can use homebrew commands to install available packages, like the one you have in step 3 (cppcheck).