Currently, from what I know, terrorists are not necessarily religiously motivated. Rather, a person is classified as a terrorist if he or she maims, kills, or even simply targets, multiple people in an indiscriminate manner purely for a purpose or gain. A disgruntled person walks into their place of work with an assault rifle. A CEO with shady backgrounds is kidnapped and murdered. Three armed subjects walk into a building and take over, demanding the release of their friend. Only one of these is an act of terrorism, the last.
The motivation is simple, there is something the person or persons believe they can gain through the use of violence and fear, aimed at a group of people. The kidnapping and murdering of the CEO is not considered terrorism because there was a specific target. The disgruntled worker did not seek to gain anything other than revenge, and/or a vent for his or her frustration.
Most of the examples I used were derived from a textbook I once stumbled upon about terrorism. I do not currently have access to that textbook.