Those tracks are called guard rails. Guard rails are placed parallel to regular running rail along areas of restrictive clearance, such as a bridge, trestle, or tunnel. These have the effect of keeping the wheels of rolling stock in alignment in case of derailment. It also helps to minimize damage to the structure and allow easier post-accident cleanup. Similarly you have check rails which are extra tracks on road surface in level crossings and have similar functions as thatcof guard rails.