Black tie, black tie optional, semi-casual, or casual can mean so many things. When it comes to wedding guest attire, guidelines are not necessarily black and white. It is important that you are comfortable in your outfit and ready to party the night away, but that you are not uncomfortable because you feel under or overdressed.
Standard dress for a guy at a wedding is a suit and tie or dress pants + tie + blazer. If you are expected to dress any fancier, the wedding invitation you received should say something like "black tie affair." Try to wear something that you already own, unless you need to buy something or want to buy something. Your shirt or pants of choice should be in good condition and washed or ironed. I have been to many weddings where it is obvious that a few gentlemen have pulled their brand new dress shirt out of a bag or back of the closet.
Think simple colors + limited patterns. Solid navy and gray are the safest colors to wear. If you don't have access to a suit, wear a nice blazer over a dress shirt or polo.
Dress shoes + a tie are most appropriate during this type of occasion. Once again, think simple colors and simple patterns such as pinstripes or dots. Avoid gaudy colors and out of this world patterns, such as dogs or tie-dye.
Weddings that occur during the day are often more informal than nighttime weddings. Daytime weddings can also lead to a more colorful wardrobe (think lighter colors / less informal / non black tie). Dressing for the season is a great guideline to follow. For example, pastels are big in the spring, bright colors are big in the summer, earth tones + browns for the fall, and deep colors of blue + green for the winter.
If you are utterly confused, ask someone close to the couple getting married. They can give you direction of what they think is appropriate or is not appropriate. Don't wear blue jeans and a t-shit, unless that's what the couple tying the knot wants you to wear. Please note: any attire related to clubbing, golfing, or funerals is not appropriate.
Either way, this is about feeling comfortable and dressing for the occasion. Not everyone will be focused on your outfit, but it is important that you are not tugging at your clothing or hiding in a corner all night long. We also don't want you to look back years from now and think, "Why in the world did I wear that?" Happy wedding!