There's some useful code for reading and modifying Xilinx bitstream files up here:
http://www.ulogic.org/tracif you want to learn more bout the Xilinx chip internals you can learn the XDL format: with the command line ISE tools you can use the flag -ncd2xdl to convert a compiled NCD design to XDL.