LONDON -- BP (LSE:BP) (NYSE:BP) and BG Group (LSE: BG) (NASDAQOTH: BRGYY) are the second and third-largest oil and gas firms in the FTSE 100.

Both companies have underperformed the FTSE 100 over the last year, especially BG Group, whose share price is 5% lower than it was 12 months ago, despite a 26% rise in the FTSE 100 over the same period.

Do BP and BG Group now look attractive, or is there a good reason investors are staying away? Let's find out.

BP vs. BG Group
I'm going to start with a look at a few key statistics that can be used to provide a quick comparison of these two companies:

Price to earnings ratio (P/E) 6.2 14.5
Dividend yield 4.5% 1.4%
Five-year average earnings-per-share growth (10.9%) (1.6%)
One-year share price change (%) 19.0% (5.5%)

BP's oil and gas business is in decent health, and despite having set $27 billion aside to deal with the costs resulting from the Gulf of Mexico oil spill, the company can afford to fund a very attractive 4.5% dividend yield.

However, some risk remains, as the final bill for the Gulf of Mexico could still be higher than expected.

BG Group's share price fell by more than 20% last October, after the firm admitted that its production output was expected to be flat this year. BG's growth record had previously sustained its premium P/E rating, but I believe that last year's fall marked the beginning of BG's transition into an ex-growth stock, that will offer more income, and less growth.

What's next?
Analysts' forecasts are notoriously unreliable, but FTSE 100 companies generally get the benefit of the most comprehensive analysis, and tend to deliver fewer surprises than smaller companies.

With that in mind, let's take a look at some forward-looking numbers for BP and BG Group. These apply to the companies' current financial years:

Forecast P/E ratio 8.9 14.8
Forecast dividend yield 5.0% 1.5%
Forecast dividend growth 9.0% 7.5%
Forecast earnings growth 38.0% (2.0%)

BG says it plans to increase its dividends in line with underlying earnings, and return cash to shareholders in the medium term. In my view, this could mean that BG shareholders are destined for several years of below-average returns, although I rate BG's long-term prospects highly.

Which share should I buy?
BG's record of finding and developing major assets is strong, and its focus on LNG is also attractive. However, I'm cautious about buying BG in the short term, as I think that it still looks a little expensive, compared to its larger peers.

If I were buying one of these shares today, it would be BP, thanks to its modest valuation, rising earnings, and 5% prospective dividend yield.

The best FTSE 100 dividends?
BP is a tempting income buy, but it isn't one of the five FTSE 100 stocks selected for the Motley Fool's latest special report, "5 Shares to Retire on".

The Fool's team of expert analysts crunched the numbers on every share in the FTSE 100 when researching this free report, and the five companies they chose all offer high-quality, reliable dividends.

If you would like to know the identity of these five top-rated dividend investments, click here now to download your copy of this report -- it's free, but availability is strictly limited, so don't delay.