A verbal noun, often with לְ, that carries purpose, time, or the gloss "to …".
לִשְׁמֹר to guard, לֵאמֹר saying. After another verb it often marks purpose or the content of speech. לֵאמֹר is a formula after אמר and similar verbs.
to guard
saying
to go
בְּ plus infinitive is often "when …"; כְּ "as / when"; מִן "from doing." Suffixes attach: בְּשָׁמְרוֹ when he guarded. This is a major clause type in law and narrative.
when he guarded
A different form (שָׁמוֹר) used for emphasis beside a finite verb, or sometimes as a command. Do not confuse it with the construct. Meet it, do not hunt it.
you shall surely guard
Hebrew verbs inflect in stems (binyanim) that shift voice and intensity on the same root.
A closed set of short words does the work of English "in, to, from, on, before, after."
Smikhut: two (or more) nouns in a row, the first in construct, the last carrying definiteness for the chain.