CSS specifity is a value given to the page by your browser to determine which CSS rules are going to be applied. The specifity is determined by the selector type. Type selectors are the least specific, thus given the lowest value; followed by class selectors and then ID selectors, which are the most specific because of their unique title. Specifity only applies when an element is addressed by multiple declarations.
Contrast ratios are ratios set by the WCAG guidelines for accessibility. These guidelines exist as a way to provide equal accessibility to those with visual impairments, such as color blindness, making them equally able to view the contents of a web page. Without these guidelines in place, many people around the world with visual impairments may not be able to use all or any of the features on a webpage/site. This can be a problem on both sides; the user can't fulfil their wishes and the page/site developers won't capitalize on web traffic or commerce. It's a lose-lose situation to not adhere to these accessibility guidelines. The desired ratios are provided through the link above.
As stated above, we must adhere to these guidelines to provide accessibility to as many users as possible. Without adhereing to these guidelines, you risk facing an audit from the government and possibly getting a page taken down until it provides the proper accessibility. Provided here is a link to the American legislation that determines the accessibility guidelines that must be met in order to be compliant
The guidlines are set by the AGWG, or the Accessibility Guidelines Working Group, who are part of the W3C web accessibility initiative, or the WAI.
Summary
Web accessibility is an integral part of the information age of society. Without these standards set, websites can be created without regards to disabled persons. This means it would be easy for businesses to discriminate against users, whether intentionally or not, and provide an unfair platform. Luckily, these guidelines do exist, and we as web developers are still able to follor them without any setbacks or issues.