Bonus codes are special "coupons" that can be exchanged for either one, or many free items - depending on the code. They are typically provided via contests or promotional emails, so stay tuned, visit GOG.com often and maybe you'll score a code or two ;).
Gift codes are codes that have been purchased by somebody on GOG and contain one or multiple games. These codes can be given to other people for them to add the game(s) to their own accounts.
To redeem a bonus code, go here. You can also redeem gift codes in this section of the site.