Quick how-to if you're not sure how to do that

Open a programmer's text editor like Smultron. Paste the lines mentionned above in it. If you copied and pasted from your browser, it may have messed up line endings so be sure to fix them (in smultron you can fix that in the text menu - select Unix line endings).
Now save the file. Navigate to your home folder (the one with a house icon, you can find it in /Macintosh HD/Users/your_user_name/)
Name the file .Xmodmap then save it. It will give you a warning about files beginning with ".". Don't cancel, save anyway.