It's a catholic idea. I think they have it from 1 cor 3.
12 Now if anyone builds on this foundation with gold, silver, precious stones, wood, hay, straw, 13 each one’s work will become clear; for the Day will declare it, because it will be revealed by fire; and the fire will test each one’s work, of what sort it is. 14 If anyone’s work which he has built on it endures, he will receive a reward. 15 If anyone’s work is burned, he will suffer loss; but he himself will be saved, yet so as through fire.
Whatever that may mean.