Attacks can be made at any time without any formal declaration of war. However, oftentimes you may find that you cannot attack another country because they are protected by GDI. By Declaring War on a country, you automatically can attack them without regard for GDI. Additionally, you gain a +10% bonus against any country you declare war with. However, they will also be able to attack you without regard for GDI, you can only make peace after 48 hours, and War costs $10/acre for each turn you are at war (included in Alliance Expenses). You may only be at war with one player at a time.
That is if you officially declared war through the attack screen. If you just pissed someone off and you 2 are ass battling, ingame messaging diplomacy is the only way unless you can grow larger than the parameters for attacking.