When you desire something greatly, you have it in your dreams.
In the same way men who desire sex dream about sex, you desire beer so you dream about beer.
Actually, I think it's a good thing to help you quit. It's always better to dream about beer than to have the real thing right? It's your mind's way of relieving the pressure of not being able to get what you want.
Of course, dreams are not something that is fully understood. In many tests involving rats who were placed in a maze, their dreams reflected them reliving this maze and EVEN TRYING TO SIMULATE the solution.
Your dream could either be a way of relieving stress or it could be your mind trying to find a way to get it. It's scientifically a difficult thing to understand and I'm not the one to give you a definite answer since the only knowledge I have of dreaming comes from a documentary of a few dream studies on lab rats and a few of my own experiences.