A warship is any vessel, whether on the ocean or in outer space, built specifically for combat, distinguishing it from an armed ship that is designed for other purposes. Warships are heavily armed and carry defenses appropriate to their combat role (armor, ECM, etc.).
Classes of Warship
While most Federation starships in the TNG-era of Star Trek are warships (having been designed to defend the Federation at need), they lack the design focus of a truly dedicated warship. They tend to serve multiple non-military functions including exploration, scientific research, diplomatic negotiations, and transport in addition to being the Federation's main line of defense. This is in stark contrast with the TOS-era, when the ships tended to be more focused on defense and exploration.
It appears that following their alliance with the Klingons and the prolonged silence of the Romulans, the Federation felt they no longer needed to maintain as high a level of military readiness. When new threats emerged from the Borg and Dominion, the Federation realized that they were not as safe as they thought, and they once again built starships explicitly for combat, such as the Defiant-class.
The Galactic Empire has many classes of warship, including -- but not limited to -- the Imperial Star Destroyer and Executor-class Star Dreadnaught. While entirely military, Imperial Star Destroyers are multi-role warships, capable of both ship-to-ship combat in space and planetary assault.