Abarim Publications' online Biblical Hebrew Dictionary
There are three separate roots שמר (shamar), which perhaps aren't all that separate when looked at with poetically inclined eyes:
The verb שמר (shamar I) means to keep, guard, observe or give heed. HAW Theological Wordbook of the Old Testament sums up this verb with "to exercise great care over". This ubiquitous verb is used to literally mean keeping a watch out or guarding: a garden (Genesis 2:15), a brother (Genesis 4:9), a herd (Genesis 30:31), a house (2 Samuel 15:16), etcetera. Or it is used in the sense of paying heed to commands and ordinances (Deuteronomy 11:32), the way of the Lord (Genesis 18:19), one's own ways (Psalm 39:2), or general understanding (Proverbs 19:8). And it also occurs in the literal sense of storing or preserving food (Genesis 41:35), money or goods (Exodus 22:7), knowledge (Malachi 2:7), or anger (Amos 1:11).
This root's derivatives are:
- The feminine noun שמרה (shomra), meaning guard (Psalm 141:3 only).
- The feminine noun שמרה (shemura), meaning eyelid (Psalm 77:4 only).
- The masculine noun שמר (shimmur), meaning night watch (Exodus 12:42 only).
- The feminine noun (which appears in two spellings in the Bible; the one with the ת (taw) is probably older) אשמורה ('ashmura) or אשמרת ('ashmoret), meaning night watch as unit of time (Judges 7:19, Lamentations 19:19).
- The masculine noun משמר (mishmar), meaning prison (Genesis 40:3) or guard (Jeremiah 51:12). It may even mean a guarding of one's heart (Proverbs 4:23) or — in plural — observances of religious services (Nehemiah 13:14).
- The feminine noun משמרת (mishmeret), literally meaning "with the function of watching," used in the sense of a charge or obligation; an official function of guarding.
Then there's the assumed root שמר (shmr II) of the masculine noun שמר (shemer), which occurs only in the plural where it means dregs, or sedimentary residue (Psalm 75:8), or old and aged wine (Isaiah 25:6), a country at ease (Jeremiah 48:11), or stagnant hearts of men (Zephaniah 1:12). Linguist insist that that these two roots are separate (their proposed relationship obscure even, decrees BDB Theological Dictionary) but to a Hebrew audience, the link between standing a stint of night watch and wine that stands sedimenting may not have been all that recondite.
And then there's the assumed root שמר (shmr III), from whence comes the noun שמיר (shamir), denoting some kind of wild and unpleasant vegetation (usually translated with thorns). The prophet Isaiah uses the word frequently to tell what will happen to a wasted and abandoned land (5:6, 7:23, 27:4). Again, the meaning of this root doesn't seem to be very far removed from the previous two. A bit of a challenge arises in the usages of this noun in Ezekiel 3:9 - "like emery harder than flint I have made your forehead" - and Zechariah 7:12 - "and they made their hearts like flint," but much of that challenge is met by the above referenced text of Zephaniah 1:12.