to keep: hold on to something and not let it go, whether a vineyard you guard or anger you refuse to release
At its core this is one of the Bible's ordinary words for keeping, very close to the more common Hebrew verbs for guarding and watching over. It pictures holding on to something so it is not lost or let go. The two faces it shows in Scripture are the same act aimed at two very different objects.
In the Song of Songs it keeps a vineyard: watching over it, tending it, staying on duty so the fruit is not stolen or spoiled. That is the plain, physical picture, and it is the root meaning everything else grows out of.
Elsewhere the thing kept is anger. To keep anger is to nurse a grudge, to hold a wrong in the heart instead of letting it go, the way English speakers say someone harbors resentment. The same holding-on that guards a vineyard becomes, when the object is a wound, the refusal to forgive. Almost every time the Bible uses it this way it is denying that God does so forever, or forbidding people to do it at all.