Urban Internet of Things systems are characterized by their application domain and they are designed to support the Smart City (SC) vision. The SC objective is to exploit advanced communication technologies to support the delivery of high quality services. A key element in a SC is the Smart Grid System (SGS), which is meant to be more efficient, reliable, and secure in managing electric power resources. SGS rely in the collection and analysis of data coming from devices such as sensors across the grid, which allow automated systems to perform advanced actions to accomplish its goals of efficiency and reliability. However, with the use of SGS, we are experiencing grand security challenges to protect such advanced and complex systems against errors and cyberattacks. In this work, we present an anomaly behavior analysis (ABA) system to detect and categorize several fault scenarios that may occur in SGSs. We tested our approach to detect normal operations, physical failures, and cyber-attacks. We applied our ABA methodology to a smart phasor measurement unit (PMU) to analyze, identify, and categorize the different SGS behaviors. The results show that our methodology can be used to accurately detect threats in both SGS and PMU with high detection rates and low false alarms.