These are referred to as votive candles, and people purchase and light them to symbolize their prayers or devotion. The candle continues to burn for some hours or days (depending on the size) and thus signals the prayer and love of the person who lit it, long after they must go.
Biblically, the root of this practice is the notion of a “burnt offering.” In the Old Testament, things of value (usually sacrificed animals) would be burned and thereby offered to God. The smoke was a symbol of the sacrifice of praise ascending to God.
Catholics who light candles are making an offering to God of prayer and praise. The fire of the candle symbolizes ardent love.
The consuming of the candle symbolizes the oblation (offering) of something of value to God: our time, our praise, our resources and so forth. The lingering quality of the candle symbolizes the fact that our prayers, praise and concerns continue in our heart even when we must leave the church. The flickering light also seems to say “Remember me, Lord, remember my prayer and those for whom I pray.”
Electric votive candles do not as clearly show these symbols, but the idea is still the same.