The games are typically designed with one of the systems in mind and then ported to the other. Last generation the XBOX 360 was the go to to develop on for most developers. Then it was ported to the other system.
Some PC games are built specifically on PC, but PC gamers generally complain about getting ports on console games as well.
As for being identical, they are in terms of features, and most everything noticeable, but there is usually a slight optimization difference, which is why some noticed that PS3 games not built for the PS3 looked slightly worse on PS3.