Credit ratings impact the cost of borrowing

How do credit ratings impact the cost of borrowing for a company?