There isn't a universally agreed upon definition, but generally it refers to targeting non-combatants: https://en.wikipedia.org/wiki/Terrorism
For example, when the Allies tried to assassinate Hitler with a smuggled briefcase bomb during WW2, that wasn't terrorism: that was just regular warfare. Hitler was the leader of Germany and directed its military.
Similarly, smuggling pager bombs to members of Hezbollah generally wouldn't qualify as terrorism, since Hezbollah a) is a militia (famously it's the largest non-state militia in the world), and b) was actively fighting a war against Israel — a war that Hezbollah themselves initiated.