When does terrorism become an act of war, instead of a crime?

What exactly does this entail or mean? Should the U.S. not have gone after the Taliban in Afghanistan? Sure, maybe al-Qaeda terrorists and bin Laden could have been tried in U.S. court, but how do you catch them?