For no man can lay a foundation other than the one which is laid, which is Jesus Christ. Now if any man builds on the foundation with gold, silver, precious stones, wood, hay, straw, each man's work will become evident; for the day will show it because it is to be revealed with fire, and the fire itself will test the quality of each man's work. If any man's work which he has built on it remains, he will receive a reward. If any man's work is burned up, he will suffer loss; but he himself will be saved, yet so as through fire.
This verse makes an important distinction between rewards in Heaven and salvation. Keep in mind that a reward is something that you earn, while a gift is something you do not earn.
In this passage, Paul describes our savior as the foundation: Jesus Christ. Notice that there is no other foundation… He is it. (See Acts 4:12) Upon that foundation, one can build with precious stones or wood, hay and straw. The precious stones represent divine good works… works which God approves of in both content and motive. The wood, hay and straw is human good works… works which God does NOT approve of… the content might be good, but the motivation is evil. (pride, thinking that you're working your way to heaven, etc.). But at the judgement seat of Christ, these things are put to the test and the wood, hay and straw are burned up and are gone. But the gold, silver and precious stones pass the test. Rewards in heaven are distributed to those who are left with the precious stones, but those whose works are burned up suffer the loss of their rewards. But in the end, even the person who suffers loss is still saved!! The foundation remains untouched.