BEIRUT, Lebanon — As foreign fighters pour into Syria at an increasing clip, extremist groups are carving out pockets of territory that are becoming havens for Islamist militants, posing what United States and Western intelligence officials say may be developing into one of the biggest terrorist threats in the world today.