Basic Cover

Infantry can take cover behind objects such as walls and sandbags. While units are in cover, they receive less damage.
To control were your units will take cover you can just hover your mouse near the cover and right click. By a green indicator light, it is shown were your units will take cover. You can also right-click-drag over the cover in the direction of the enemy or spot they should take cover from. Your units will automatically search for the best spot to get into cover.

Cover in Buildings

As an added mechanic, infantry can also take cover in the majority of buildings found upon the map. From within buildings they can resist even more damage. However, some units get slightly decreased fire speed and units inside the building can only shoot out of windows.
Buildings are like an upgraded version of the normal cover, but they can still be destroyed by grenades, mechs, and other explosive weaponry. Just something else to watch out for when staying in cover. How easy they can get destroyed by grenades and explosives depends on the size of the house and the number of rooms it has. Once all rooms are destroyed the units are forced to leave.