Which one is the correct sentence?
a) Please eat the toffee before it hardens.
b) Please eat the toffee before it hardened.
Let's suppose you are being told that sentence by another person who is asking you to eat the toffee in its current state before it gets into another state which is to become hard.
But "hard" is an adjective, and in your sentence, it takes the forms of a verb which is "harden".
So, as the toffee didn't become hard yet, and the request is in the present tense, that makes the first sentence the correct one:
Please eat the toffee before it hardens.
You can say "hardened" in the following form, but the meaning would differ:
Please eat the toffee because it hardened.
In between these two sentences, a is the correct one.
b needs to be corrected like this:
Please eat the toffee before it gets hardened.
The latter part of the sentence, after "before" , should be constructed in the present tense anyway.