Why does the cold water pipe rattle when my washing machine is set to hot?
Its called "water hammering".   You will need to have a water hammer suppressor installed.    You can buy one that simply screws on to the faucet and then you connect your washer hose to it.  

You can buy them at your local hardware store such as Home Depot, Lowes, Ace Hardware, or any other hardware store of your choice.  

Here is a link to describe the science behind it
http://en.wikipedia.org/wiki/Water_hammer